/**
 * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

package com.triumphsys.icici.cmeeting.portlet.model.impl;

import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.util.GetterUtil;
import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.model.impl.BaseModelImpl;
import com.liferay.portal.service.ServiceContext;
import com.liferay.portal.util.PortalUtil;

import com.liferay.portlet.expando.model.ExpandoBridge;
import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;

import com.triumphsys.icici.cmeeting.portlet.model.CMUser;
import com.triumphsys.icici.cmeeting.portlet.model.CMUserModel;

import java.io.Serializable;

import java.lang.reflect.Proxy;

import java.sql.Types;

/**
 * The base model implementation for the CMUser service. Represents a row in the &quot;CM_USER&quot; database table, with each column mapped to a property of this class.
 *
 * <p>
 * This implementation and its corresponding interface {@link com.triumphsys.icici.cmeeting.portlet.model.CMUserModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link CMUserImpl}.
 * </p>
 *
 * <p>
 * Never modify or reference this class directly. All methods that expect a c m user model instance should use the {@link com.triumphsys.icici.cmeeting.portlet.model.CMUser} interface instead.
 * </p>
 *
 * @author Triumphsys
 * @see CMUserImpl
 * @see com.triumphsys.icici.cmeeting.portlet.model.CMUser
 * @see com.triumphsys.icici.cmeeting.portlet.model.CMUserModel
 * @generated
 */
public class CMUserModelImpl extends BaseModelImpl<CMUser>
	implements CMUserModel {
	public static final String TABLE_NAME = "CM_USER";
	public static final Object[][] TABLE_COLUMNS = {
			{ "userId", new Integer(Types.BIGINT) },
			{ "userIp", new Integer(Types.BIGINT) },
			{ "userDomain", new Integer(Types.VARCHAR) }
		};
	public static final String TABLE_SQL_CREATE = "create table CM_USER (userId LONG not null primary key,userIp LONG,userDomain VARCHAR(75) null)";
	public static final String TABLE_SQL_DROP = "drop table CM_USER";
	public static final String DATA_SOURCE = "liferayDataSource";
	public static final String SESSION_FACTORY = "liferaySessionFactory";
	public static final String TX_MANAGER = "liferayTransactionManager";
	public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
				"value.object.entity.cache.enabled.com.triumphsys.icici.cmeeting.portlet.model.CMUser"),
			true);
	public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
				"value.object.finder.cache.enabled.com.triumphsys.icici.cmeeting.portlet.model.CMUser"),
			true);
	public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.util.service.ServiceProps.get(
				"lock.expiration.time.com.triumphsys.icici.cmeeting.portlet.model.CMUser"));

	public CMUserModelImpl() {
	}

	public long getPrimaryKey() {
		return _userId;
	}

	public void setPrimaryKey(long pk) {
		setUserId(pk);
	}

	public Serializable getPrimaryKeyObj() {
		return new Long(_userId);
	}

	public long getUserId() {
		return _userId;
	}

	public void setUserId(long userId) {
		_userId = userId;
	}

	public String getUserUuid() throws SystemException {
		return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
	}

	public void setUserUuid(String userUuid) {
		_userUuid = userUuid;
	}

	public long getUserIp() {
		return _userIp;
	}

	public void setUserIp(long userIp) {
		_userIp = userIp;
	}

	public String getUserDomain() {
		if (_userDomain == null) {
			return StringPool.BLANK;
		}
		else {
			return _userDomain;
		}
	}

	public void setUserDomain(String userDomain) {
		_userDomain = userDomain;
	}

	public CMUser toEscapedModel() {
		if (isEscapedModel()) {
			return (CMUser)this;
		}
		else {
			return (CMUser)Proxy.newProxyInstance(CMUser.class.getClassLoader(),
				new Class[] { CMUser.class }, new AutoEscapeBeanHandler(this));
		}
	}

	public ExpandoBridge getExpandoBridge() {
		if (_expandoBridge == null) {
			_expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(0,
					CMUser.class.getName(), getPrimaryKey());
		}

		return _expandoBridge;
	}

	public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
		getExpandoBridge().setAttributes(serviceContext);
	}

	public Object clone() {
		CMUserImpl cmUserImpl = new CMUserImpl();

		cmUserImpl.setUserId(getUserId());

		cmUserImpl.setUserIp(getUserIp());

		cmUserImpl.setUserDomain(getUserDomain());

		return cmUserImpl;
	}

	public int compareTo(CMUser cmUser) {
		long pk = cmUser.getPrimaryKey();

		if (getPrimaryKey() < pk) {
			return -1;
		}
		else if (getPrimaryKey() > pk) {
			return 1;
		}
		else {
			return 0;
		}
	}

	public boolean equals(Object obj) {
		if (obj == null) {
			return false;
		}

		CMUser cmUser = null;

		try {
			cmUser = (CMUser)obj;
		}
		catch (ClassCastException cce) {
			return false;
		}

		long pk = cmUser.getPrimaryKey();

		if (getPrimaryKey() == pk) {
			return true;
		}
		else {
			return false;
		}
	}

	public int hashCode() {
		return (int)getPrimaryKey();
	}

	public String toString() {
		StringBundler sb = new StringBundler(7);

		sb.append("{userId=");
		sb.append(getUserId());
		sb.append(", userIp=");
		sb.append(getUserIp());
		sb.append(", userDomain=");
		sb.append(getUserDomain());
		sb.append("}");

		return sb.toString();
	}

	public String toXmlString() {
		StringBundler sb = new StringBundler(13);

		sb.append("<model><model-name>");
		sb.append("com.triumphsys.icici.cmeeting.portlet.model.CMUser");
		sb.append("</model-name>");

		sb.append(
			"<column><column-name>userId</column-name><column-value><![CDATA[");
		sb.append(getUserId());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>userIp</column-name><column-value><![CDATA[");
		sb.append(getUserIp());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>userDomain</column-name><column-value><![CDATA[");
		sb.append(getUserDomain());
		sb.append("]]></column-value></column>");

		sb.append("</model>");

		return sb.toString();
	}

	private long _userId;
	private String _userUuid;
	private long _userIp;
	private String _userDomain;
	private transient ExpandoBridge _expandoBridge;
}